<!-- 模块说明 -->
<script setup>
import { ref } from "vue";
const val = ref("");
defineProps({
  modelValue: String,
});
const emit = defineEmits(["enter", "update:modelValue"]);
const enter = () => {
  emit("enter", val.value);
  val.value = "";
};
const change = (e) => {
  emit("update:modelValue", e.target.value);
};
</script>
<template>
  <div class="box">
    <p>
      <input v-model="val" type="text" @input="change($event)" />
      <button @click="enter">添加</button>
    </p>
  </div>
</template>

<style lang="scss" scoped></style>
